package com.example.demo.controller;

import com.example.demo.service.FileService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import org.springframework.web.multipart.MultipartFile;


/**
 * Created by nishuai on 2017/12/26.
 */

@RestController
@RequestMapping("file")
public class FileController {
    @Resource
    FileService fileService;

    //处理文件上传
    @PostMapping("addFile")
    public @ResponseBody String uploadImg(@RequestParam("files") MultipartFile file) {
        if (!file.isEmpty()){
            return fileService.addFile(file);
        }else{
            return null;
        }
    }


}